const Sequelize = require('sequelize');
const baseModel = require('../baseModel');

class userModel extends baseModel{
  constructor(){
    super('user',{
      id:{
        type: Sequelize.INTEGER,
        autoIncrement: true,
        allowNull: false,
        primaryKey:true
      },
      org: {
        type: Sequelize.INTEGER,
        allowNull: false
      },
      account:{
        type: Sequelize.STRING(16),
        allowNull: false,
        primaryKey:true
      },
      password:{
        type: Sequelize.STRING(16),
        allowNull: false
      },
      name:{
        type: Sequelize.STRING(16),
        allowNull: false
      },
      avatar:{
        type: Sequelize.STRING,
        allowNull: false
      },
      roles:{
        type: Sequelize.STRING(20),
        allowNull: false
      },
      updatedAt:{
        type: Sequelize.DATE,
        allowNull: false,
      },
      createdAt:{
        type: Sequelize.DATE,
        allowNull: false
      }
    });
    this.model = super.getModel();
    this.model.sync();
  }
}

module.exports = new userModel();
